package cn.com.test;

import cn.com.webxml.MobileCodeWS;
import cn.com.webxml.MobileCodeWSSoap;

import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import java.net.MalformedURLException;
import java.net.URL;

/**
 * 2019/11/27
 * Administrator
 * webClient001
 * 面向对象面向君  不负代码不负卿
 */
public class Demo1 {
    public static void main(String[] args) {
      /*      //1.创建服务对象
        MobileCodeWS mobileCodeWS=new MobileCodeWS();
        //2.传递接口类型
        MobileCodeWSSoap soap = mobileCodeWS.getPort(MobileCodeWSSoap.class);
        //3.调用方法
        String info = soap.getMobileCodeInfo("1831053", "");
        System.out.println(info);
        String[] strings = info.split("：");
        System.out.println(strings[1]);*/


        try {
            //调用方式2：
            URL url = new URL("http://ws.webxml.com.cn/WebServices/MobileCodeWS.asmx?wsdl");
            //参数:namespace,servicename
            QName qName = new QName("http://WebXml.com.cn/","MobileCodeWS");
            Service service = Service.create(url, qName);
            MobileCodeWSSoap port = service.getPort(MobileCodeWSSoap.class);
            String mobileCodeInfo = port.getMobileCodeInfo("1831053", "");
            System.out.println(mobileCodeInfo);
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }

    }
}
